#include <iostream>
#include "CnfSvr.h"

using std::cout;
using std::endl;

string g_log_conf_file;
string g_mysql_ip;
int g_mysql_port;
string g_mysql_user;
string g_mysql_passwd;

int parse_args(int argc, char * argv[]) {
        char c;
        while(-1 != (c = getopt(argc, argv, "l:i:P:u:p:"))) {
                switch(c) {
                        case 'l':
                                g_log_conf_file = optarg;
                                break;
                        case 'i':
                                g_mysql_ip = optarg;
                                break;
                      	case 'P':
                                g_mysql_port = atoi(optarg);
                                break;
                      	case 'u':
                                g_mysql_user = optarg;
                                break;
                     	case 'p':
                                g_mysql_passwd = optarg;
                                break;
                        default:
                                break;
                }
        }
	return 1;
}

int main(int argc,char * argv[]) {
	parse_args(argc, argv);
	CnfSvr cs;
	int ret = cs.init("0.0.0.0", 3501, 30, g_log_conf_file.c_str(), 100, 5, 5, -1, g_mysql_ip.c_str(), g_mysql_port, \
				g_mysql_user.c_str(), g_mysql_passwd.c_str(), "SFS", 30);
	cs.start();
}
